package com.example.ecas.persistence;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.ecas.pojo.Disease;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface DiseaseMapper extends BaseMapper<Disease> {

    // 获取指定id的病类
    default Disease getDisease(int id) {
        return this.selectById(id);
    }

    // 新增一个病类
    default int addDisease(Disease disease) {
        if (disease == null) {
            return 0;
        }
        return this.insert(disease);
    }

    // 修改病类
    default int updateDisease(Disease disease) {
        if (disease != null) {
            return this.updateById(disease);
        }
        return 0;
    }

    // 删除一个病类
    default int deleteDisease(int id) {
        return this.deleteById(id);
    }
}
